import requests
import app

class EmployeeApi(object):
    def __init__(self):
        self.url_add = app.employee_base_url+'/api/sys/user'
        self.url_del = app.employee_base_url+'/api/sys/user/{}'
        self.url_update = app.employee_base_url+'/api/sys/user/{}'
        self.url_get = app.employee_base_url+'/api/sys/user/{}'

    def add_employee(self,employee_data):
        return requests.post(url=self.url_add,json=employee_data,headers=app.Header)
    def del_employee(self,employee_id,employee_data):
        return requests.post(url=self.url_del.format(employee_id),json=employee_data,headers=app.Header)
    def update_employee(self, employee_id, employee_data):
        return requests.post(url=self.url_update.format(employee_id), json=employee_data, headers=app.Header)
    def get_employee(self,employee_id,employee_data):
        return requests.get(url=self.url_get.format(employee_id),json=employee_data,headers=app.Header)